<!-- 订单详情 -->
<template>
	<view class="content">

		<Header :isShowRight="false" title="订单详情" @back='back' arrowColor='#000' textColor='#000' bgColor="#fff">
		</Header>

		<view class="contents">
			<!-- v-for='(item,index) in list.courseList' :key='index' -->
			<!-- 可能会循环 -->
			<view class="orderItem">
				<view class="img">
					<!-- <image :src="item.url" mode=""></image> -->
					<u--image :src="list.coverImg" width="110px" height="73px" radius='5px'></u--image>
				</view>
				<view class="rightBox">
					<view class="title">{{list.courseName}}</view>
					<view class="teacher">
						<text v-if='list.lecturerName'>{{'讲师:'+list.lecturerName}}</text>
						<view class=""></view>
						<view class="right">
							<text class="text1">实付款</text>
							<text class="text2">￥</text>
							<text class="text3">{{list.payMoney}}</text>
						</view>
					</view>
				</view>
			</view>
			<view class="infoBox">
				<view class="flexed">
					<text>订单编号</text>
					<text>{{list.orderNo}}</text>
				</view>
				<view class="flexed">
					<text>订单总额</text>
					<text>{{'￥'+list.totalMoney}}</text>
				</view>
				<view class="flexed">
					<text>实际付款</text>
					<text>{{'￥'+list.payMoney}}</text>
				</view>
				<view class="flexed">
					<text>付款方式</text>
					<text v-if="list.payWay==0">微信</text>
					<text v-else>支付宝</text>
				</view>
				<view class="flexed">
					<text>付款时间</text>
					<text>{{list.payTime}}</text>
				</view>
				<view class="infoType">
					<view v-if='list.invoiceFlag==0'>未开票</view>
					<view style="color:#F04848" v-else-if='list.invoiceFlag==1'>开票中</view>
					<view style="color:#3BB66C" v-else='list.invoiceFlag==2'>已开票</view>
					<view class="bgBox" v-if="list.invoiceFlag==2" @click='invoiceDetail'>发票信息</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		orderDetail
	} from '@/apis/apis.js'
	import Header from '@/components/c_header.vue'
	export default {
		components: {
			Header
		},
		data() {
			return {
				list: {},
				//订单id
				orderId: '',
				//发票详情所需的id
				invoiceId: ''
			}
		},
		created() {
			this.getDetail()
		},
		methods: {
			back() {
				uni.navigateBack({
					delta: 1
				})
			},
			//订单详情数据
			getDetail() {
				orderDetail(this.orderId).then(res => {
					console.log(res);
					this.list = res.data
					this.invoiceId = res.data.invoiceId
				})
			},
			//发票详情
			invoiceDetail() {
				uni.navigateTo({
					url: '../make?id=' + this.invoiceId
				})
			}
		},
		onLoad(options) {
			// console.log(options);
			this.orderId = options.id
		}
	}
</script>

<style lang="scss" scoped>
	.content {
		background: #F8F8F8;

		.bg {
			background: #fff;
			height: 140rpx;
			padding: 76rpx 0 0 32rpx;
		}

		.contents {
			background: #FFFFFF;
			box-shadow: 0px 4px 13px 0px rgba(127, 129, 133, 0.1500);
			border-radius: 20rpx;
			width: 92%;
			margin: 34rpx auto;

			.orderItem {
				display: flex;
				padding: 26rpx 30rpx 36rpx 26rpx;
				border-bottom: 2rpx solid #EAEAEA;
				width: 94%;
				margin: 0 auto;
				margin-bottom: 20rpx;

				.img {
					width: 220rpx;
					margin-right: 32rpx;

					&>image {
						width: 220rpx;
						height: 146rpx;
						border-radius: 10rpx;
					}
				}

				.title {
					font-size: 30rpx;
					font-family: Source Han Sans CN;
					font-weight: 500;
					color: #111111;
					line-height: 22px;
					overflow: hidden;
					-webkit-line-clamp: 2;
					text-overflow: ellipsis;
					display: -webkit-box;
					-webkit-box-orient: vertical;
				}

				.rightBox {
					width: 60%;
					display: flex;
					flex-direction: column;
					justify-content: space-between;
					padding-bottom: 2rpx;

					.teacher {
						font-size: 13px;
						font-family: Source Han Sans CN;
						font-weight: 400;
						color: #4A4A4A;
						display: flex;
						align-items: baseline;
						justify-content: space-between;

						.right {
							display: flex;
							align-items: baseline;
							justify-content: space-between;
							font-family: PingFang SC;
							font-weight: bold;
							color: #FFA025;

							.text1 {
								font-size: 13px;
								font-family: Source Han Sans CN;
								font-weight: 400;
								color: #4A4A4A;
								margin-right: 14rpx;
							}

							.text2 {
								font-size: 22rpx;
							}

							.text3 {
								font-size: 36rpx;
							}
						}
					}
				}

			}

			// .orderItem:last-child{
			// 	border:none
			// }

			.infoBox {
				padding: 0 28rpx 10rpx 28rpx;
				position: relative;

				.flexed {
					display: flex;
					align-items: center;
					font-size: 28rpx;
					font-family: Source Han Sans CN;
					color: #9B9B9B;
					margin-bottom: 46rpx;

					&>text:nth-child(2) {
						color: #333333;
						margin-left: 100rpx;
					}
				}

				.infoType {
					display: flex;
					flex-direction: column;
					align-items: center;
					position: absolute;
					top: 24rpx;
					right: 28rpx;
					z-index: 99;
					font-size: 14px;
					font-family: Source Han Sans CN;
					font-weight: 400;

					.bgBox {
						width: 128rpx;
						height: 46rpx;
						background: rgba(28, 183, 255, 0.1500);
						border-radius: 10rpx;
						line-height: 46rpx;
						text-align: center;
						margin-top: 20rpx;
						color: #238DF6;

					}

					.color1 {
						color: #3BB66C;
					}

					.color2 {

						color: #F04848;
					}
				}
			}
		}
	}
</style>
